package com.ss.android.article.base.feature.pgc;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import com.ss.android.article.base.feature.feed.i;
import com.ss.android.article.base.feature.splash.SplashAdActivity;
import com.ss.android.article.base.feature.subscribe.activity.j;
import com.ss.android.article.browser.R;
import com.ss.android.newmedia.activity.FragmentActivity;

public class PgcSearchActivity extends FragmentActivity implements i {
    public String gdExtJson;
    private boolean slideOutLeft;

    public PgcSearchActivity() {
        this.slideOutLeft = false;
    }

    public Fragment a() {
        return new j();
    }

    public int getDayBackgroundRes() {
        return R.color.pg;
    }

    public int getLayout() {
        return R.layout.fragment_activity;
    }

    public int getNightBackgroundRes() {
        return R.color.ph;
    }

    public void init() {
        super.init();
        this.mRootView.setBackgroundResource(this.getDayBackgroundRes());
        this.mTitleView.setText(com.ss.android.article.browser.R.string.title_pgc_search);
        this.mTitleBar.setVisibility(View.GONE);
        Fragment fragment = this.a();
        Intent intent = this.getIntent();
        if(intent != null) {
            this.slideOutLeft = intent.getBooleanExtra("slide_out_left", false);
            String keyword = intent.getStringExtra("keyword");
            String from = intent.getStringExtra("from");
            if(!android.support.design.a.isTextEmpty(keyword)) {
                Bundle bundle = new Bundle();
                bundle.putString("keyword", keyword);
                bundle.putString("from", from);
                fragment.setArguments(bundle);
            }
            this.gdExtJson = intent.getStringExtra("gd_ext_json");
        }
        FragmentTransaction fragmentTransaction = this.getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(com.ss.android.article.browser.R.id.fragment_container, fragment, "pgc_search_fragment");
        fragmentTransaction.commit();
        this.getWindow().setSoftInputMode(2);
    }

    public void onBackPressed() {
        Fragment fragment = this.getSupportFragmentManager().findFragmentById(com.ss.android.article.browser.R.id.fragment_container);
        boolean v0_1 = fragment instanceof com.ss.android.article.base.feature.search.r && ((com.ss.android.article.base.feature.search.r) fragment).p();
        if(!v0_1) {
            this.finish();
        }
    }

    public void onCreate(Bundle savedInstanceState) {
        this.requestDisableOptimizeViewHierarchy();
        super.onCreate(savedInstanceState);
    }

    public void onCreateHook() {
    }

    public void onResume() {
        super.onResume();
        SplashAdActivity.a(this, false);
    }

    public boolean useSwipeRight() {
        return !this.slideOutLeft;
    }
}

